package com.biz.primus.management.cat.feign;

import com.biz.primus.common.vo.SpringPageVO;
import com.biz.primus.management.cat.degraded.DegradedCatFeignClient;
import com.biz.primus.model.cat.enums.CatSaleStatusEnum;
import com.biz.primus.model.cat.enums.CatStatus;
import com.biz.primus.model.cat.vo.CatQueryVo;
import com.biz.primus.model.cat.vo.CatVo;
import java.util.List;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author defei
 * @date 2017/9/13
 */
@FeignClient(qualifier = "catFeignClient", name = "service-cat", fallback = DegradedCatFeignClient.class)
public interface CatFeignClient {

    @PostMapping("soa/catService/save")
    CatVo save(@RequestBody CatVo cat);

    @PostMapping("soa/catService/getByName")
    CatVo getByName(@RequestParam("name") String name);

    @PostMapping("soa/catService/listByStatus")
    List<CatVo> listByStatus(@RequestParam("status") CatStatus status);

    @PostMapping("soa/catService/listBySaleStatus")
    List<CatVo> listBySaleStatus(@RequestParam("saleStatus") CatSaleStatusEnum saleStatus);

    @GetMapping("soa/catService/get")
    CatVo get(@RequestParam("id") Long id);

    @PostMapping("soa/catService/updateSaleStatus")
    void updateSaleStatus(@RequestParam("id") Long id, @RequestParam("saleStatus") CatSaleStatusEnum saleStatus);

    @PostMapping("soa/catService/findAll")
    SpringPageVO<CatVo> findAll(@RequestBody CatQueryVo queryVo);

}
